date_add
DateTime::add alias: Add a certain amount of days, months, years, hours, minutes and seconds to a DateTime object.
date_add()
function adds a date, month, year, hour, minute, and second to a date.
Added 100 days to October 15, 1980:
<?php $date = date_create ( "1980-10-15" ) ; date_add ( $date , date_interval_create_from_date_string ( "100 days" ) ) ; echo date_format ( $date , "Ymd" ) ; ?>
Try it yourself
date_add ( object , interval ) ;
parameter | describe |
---|---|
object | Required. Specifies the DateTime object returned by date_create() . |
interval | Required. Specifies the DateInterval object. |